package com.ibm.ibank.demo.mybatis.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.web.bind.annotation.PathVariable;

import com.ibm.ibank.demo.mybatis.entity.GpDbmRel;
import com.ibm.ibank.demo.mybatis.mapper.GpDbmRelMapper;
import com.ibm.ibank.demo.mybatis.service.GpDbmRelService;
import com.ibm.ibank.demo.mybatis.service.UserService;

import lombok.extern.slf4j.Slf4j;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ZW
 * @since 2020-06-26
 */
@Service
@Primary
@Slf4j
public class GpDbmRelServiceImpl implements GpDbmRelService {
	@Autowired
	GpDbmRelMapper serv;
	@Autowired
	UserService user;
	@Override
	@Transactional
	public GpDbmRel getRel(@PathVariable String id) {
		boolean readonly = TransactionSynchronizationManager.isCurrentTransactionReadOnly();
		log.info("readonly: {}", readonly);
		GpDbmRel selectById = serv.selectById(id);
		user.hello("Johnny");
		return selectById;
	}
}
